﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using DataAccessLayer.Models;

namespace PresentationLayerMVC.Controllers
{
    public class ApplicationController : Controller
    {
        IAppRepository repo;

        public ApplicationController()
        {
            repo = new ApplicationRepository();
        }

        //
        // GET: /Summary/

        public ActionResult Index(int? applicationId)
        {
            //LOSEntities ctx = new LOSEntities();
            //var model = ctx.Applications.AsEnumerable();

            //if (applicationId != null)
            //{
            //    var application = (from a in ctx.Applications
            //                       where a.AppId == applicationId
            //                select a).SingleOrDefault();

            //    ViewData["Application"] = application;
            //}
            int id = (int)applicationId;
            Application app = repo.FindApplication(id);
            return View(app);
        }

    }
}
